FIX - implement OCI runtime state command [Enhancement]#621
Open
abhaygoudannavar wants to merge 4 commits intourunc-dev:mainfrom
Open
FIX - implement OCI runtime state command [Enhancement]#621abhaygoudannavar wants to merge 4 commits intourunc-dev:mainfrom
abhaygoudannavar wants to merge 4 commits intourunc-dev:mainfrom
Conversation
When timestamps are enabled but the target file cannot be opened (e.g. missing directory), NewZerologMetrics returned nil. This caused a nil pointer dereference on subsequent metrics.Capture() calls. This fix gracefully degrades to a no-op mockWriter and logs a warning. Signed-off-by: abhaygoudannavar <abhaysgoudnvr@gmail.com>
Added TestZerologMetricsInvalidFileDoesNotPanic to ensure that if the metrics log file cannot be opened, it gracefully degrades instead of causing a nil pointer dereference. Signed-off-by: abhaygoudannavar <abhaysgoudnvr@gmail.com>
Add the state command as defined in the OCI Runtime Specification (Query State). The command reads the persisted state.json and outputs OCI-compliant JSON to stdout. Falls back to runc for non-unikernel containers. Signed-off-by: abhaygoudannavar <abhaysgoudnvr@gmail.com>
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
Hello @abhaygoudannavar , this PR contains unrelated changes. Also please use a similar implementation with https://github.com/opencontainers/runc/blob/main/state.go |
Author
|
@cmainas, I have updated the PR to resolve both of your points:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements the OCI
statecommand forurunc, which outputs the current state information of a container instance conforming to the OCI runtime specification.The implementation has been aligned with the reference
runcimplementation. Instead of blindly reading and marshalingstate.json, it dynamically verifies the process status (usingsyscall.Kill(pid, 0)) to detect if the VMM has exited. It formats the JSON output using a customcontainerStatestruct exactly asruncdoes to ensure orchestrators parsing the output receive the expected OCI schema.Related issues
How was this tested?
urunc.urunc state <container-id>while the container was running and verified the output correctly matched the OCI JSON schema with status"running".urunc state <container-id>again, verifying it correctly dynamically detected the stopped state (returningstatus: "stopped"andpid: 0).make unittestand verified no existing tests were broken.LLM usage
No usage
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).